home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / E-Z Progress Bar 1.0a / ProgressClass.h < prev   
C/C++ Source or Header  |  1995-03-15  |  2KB  |  87 lines

  1. #include "ChiselClass.h"
  2. #include "Environ.h"
  3.  
  4. enum    progressBarFlags { progressDefaults=-1, canCancel=2, chiselFrame=4, grayBack=8, chiselBar=16, fineChisel=32 };
  5.  
  6. #define wLeft 150
  7. #define wTop 150
  8. #define wRight wLeft+300
  9. #define wBottom wTop+120
  10.  
  11. class    ProgressClass {
  12.  
  13. protected:
  14.     WindowPtr    theWindow;
  15.  
  16.     Rect        windowRect;
  17.     Rect        controlRect;
  18.     
  19.     Rect        emptyBar;
  20.     Rect        progressBar;
  21.     Rect        frameBar;
  22.     
  23.     float        kBarWidth;
  24.     short        kBarHeight;
  25.     float        pBarWidth;
  26.     
  27.     float        minValue, maxValue;
  28.     float        curValue;
  29.     
  30.     short        appleMenu, menu1, menu2, menu3, menu4, menu5, menu6, menu7, menu8;
  31.     short        appleDivider;
  32.     
  33.     RGBColor    emptyColor, progressColor, windowColor;
  34.     Boolean        cancel, chiselP, chiselF, grayWin, useRGB, chiselH;
  35.     ControlHandle    cancelButton;
  36.     
  37.     EventRecord    theEvent;
  38.         
  39.     ChiselClass    frameChisel, progChisel, hairChisel;
  40.     
  41.     Point        textPoint;
  42.     Str255        progressText;
  43.     short        maxCharWid;
  44.     
  45.     void        DrawProgressBar();
  46.     void        DrawProgressText();
  47.     
  48.     void        DeselectItems(short menuID);
  49.     void        SelectItems(short menuID);
  50.     void        DimMenus();
  51.     void        HiliteMenus();
  52.  
  53.     void        PositionElements(Str255 paramText);
  54.     void        SetCancelButton(short controlID=0);
  55.     void        ReplaceText(Str255 paramText);
  56.     void        UpdateWindow();
  57.  
  58. public:
  59.     ProgressClass(short options=progressDefaults);
  60.     ~ProgressClass();
  61.     
  62.     void        SetMinMax(short min, short max);
  63.     void        SetControlID(short controlID);
  64.     void        SetAppleMenu(short appleID);
  65.     void        SetMenus(short m1=0, short m2=0, short m3=0, short m4=0, short m5=0, short m6=0, short m7=0, short m8=0);
  66.     void        SetTexts(Str255 windowTitle, Str255 paramText);
  67.     
  68.     void        SetOptions(short options=progressDefaults);
  69.  
  70.     void        HideBarWindow();
  71.     void        ShowBarWindow();
  72.     
  73.     void        SetBar(short current);
  74.     void        SetBar(short current, Str255 paramText);    //    use to change text
  75.     void        SetBar(float current);                        //    use for fractional numbers
  76.     void        SetBar(float current, Str255 paramText);
  77.  
  78.     Boolean        ReceivedEvent(Boolean *userCancel, Boolean *deactivate, WindowPtr *updateWindow);
  79.     
  80.     void        SetEmptyColor(RGBColor theColor);
  81.     void        SetBarColor(RGBColor theColor);
  82.     void        SetWindowColor(RGBColor theColor);
  83.     void        SetBarHeight(short height);
  84.     void        SetBarWidth(short width);
  85. };
  86.  
  87.